package com.tocchisu.tv.model;

import org.joda.time.Period;

public enum Hourly {
  MIDNIGHT(0), ONE(1), TWO(2), THREE(3), FOUR(4), FIVE(5), SIX(6), SEVEN(7), HEIGHT(8), NINE(9), TEN(10), ELEVEN(11), TWELVE(12), THIRTEEN(13), FOURTEEN(14), FIFTEEN(15), SIXTEEN(16), SEVENTEEN(17), HEIGTEEN(
      18), NINETEEN(19), TWENTY(20), TWENTYONE(21), TWENTYTWO(22), TWENTYTHREE(23);

  private Period period;
  private final Period hourlyDuration = new Period(1, 0, 0, 0).toPeriod();

  private Hourly(int hours) {
    period = new Period();
    for (int i = 0; i < hours; i++) {
      period = period.plus(hourlyDuration);
    }
  }

  public Period getPeriod() {
    return period;
  }

  public Hourly getNextHourly() {
    return Hourly.values()[(this.ordinal() + 1) % Hourly.values().length];
  }

  public Period getHourlyDuration() {
    return hourlyDuration;
  }
}
